﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:TubeStar">

    <Style TargetType="ToolTip">
        <Setter Property="FontFamily" Value="Segoe UI"/>
    </Style>

    <Style x:Key="DialogLabelStyle" TargetType="TextBlock">
        <Setter Property="TextWrapping" Value="Wrap"/>
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="Margin" Value="5,2,5,2"/>
    </Style>

    <Style x:Key="ClickStyle" TargetType="FrameworkElement">
        <Style.Resources>
            <Storyboard x:Key="OnClickAnimation">
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="{x:Null}">
                    <EasingDoubleKeyFrame KeyTime="0" Value="0.97"/>
                    <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="{x:Null}">
                    <EasingDoubleKeyFrame KeyTime="0" Value="0.97"/>
                    <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1"/>
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>
        </Style.Resources>

        <Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
        <Setter Property="RenderTransform">
            <Setter.Value>
                <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform/>
                    <TranslateTransform/>
                </TransformGroup>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="TriggerClickStyle" TargetType="FrameworkElement" BasedOn="{StaticResource ClickStyle}">
        <Style.Triggers>
            <EventTrigger RoutedEvent="ButtonBase.PreviewMouseLeftButtonDown">
                <BeginStoryboard x:Name="OnClick1_BeginStoryboard" Storyboard="{StaticResource OnClickAnimation}"/>
            </EventTrigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="local:ChannelBlock" BasedOn="{StaticResource ClickStyle}" />
    <Style TargetType="local:TodoTask" BasedOn="{StaticResource ClickStyle}" />
    <Style TargetType="local:AppointmentBlock" BasedOn="{StaticResource ClickStyle}" />
    <Style TargetType="local:StoreItemBlock" BasedOn="{StaticResource ClickStyle}" />
    <Style TargetType="local:VideoBlock" BasedOn="{StaticResource ClickStyle}" />
    <Style TargetType="local:VideoBlockGrid" BasedOn="{StaticResource ClickStyle}" />

    <Style TargetType="Button" BasedOn="{StaticResource TriggerClickStyle}">
        <Setter Property="MinHeight" Value="25" />
        <Setter Property="FontWeight" Value="Bold" />
        <Setter Property="Background" Value="White" />
        <Setter Property="Padding" Value="5,6" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="MouseOverBorder">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="DisabledVisualElement">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="0.7" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="contentPresenter">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0.2" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Background"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                Background="{TemplateBinding Background}"/>
                        <Rectangle x:Name="DisabledVisualElement"
                                   Fill="{DynamicResource ControlsDisabledBrush}"
                                   IsHitTestVisible="false"
                                   Opacity="0" />
                        <Border x:Name="MouseOverBorder"
                                Background="Gray"
                                BorderThickness="0"
                                Opacity="0" />
                        <ContentPresenter x:Name="contentPresenter"
                                          RecognizesAccessKey="True"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Margin="{TemplateBinding Padding}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="Button" x:Key="NonAnimatedButtonStyle">
        <Setter Property="MinHeight" Value="25" />
        <Setter Property="FontWeight" Value="Bold" />
        <Setter Property="Background" Value="#FFF7F7F7" />
        <Setter Property="Padding" Value="5,6" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="MouseOverBorder">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="DisabledVisualElement">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="0.7" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="contentPresenter">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0.2" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Background"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Background="{TemplateBinding Background}" />
                        <Rectangle x:Name="DisabledVisualElement"
                                   Fill="{DynamicResource ControlsDisabledBrush}"
                                   IsHitTestVisible="false"
                                   Opacity="0"
                                   RadiusY="3"
                                   RadiusX="3" />
                        <Border x:Name="MouseOverBorder"
                                Background="LightGray"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Opacity="0" />
                        <ContentPresenter x:Name="contentPresenter"
                                          RecognizesAccessKey="True"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          HorizontalAlignment="Left"
                                          Margin="{TemplateBinding Padding}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ToggleButton" BasedOn="{StaticResource TriggerClickStyle}">
        <Setter Property="MinHeight" Value="25" />
        <Setter Property="FontWeight" Value="Bold" />
        <Setter Property="Background" Value="White" />
        <Setter Property="Padding" Value="5,6" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToggleButton">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="MouseOverBorder">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="CheckedBorder">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="DisabledVisualElement">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="0.7" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="contentPresenter">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0.2" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Background"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Background="{TemplateBinding Background}"/>
                        <Rectangle x:Name="DisabledVisualElement"
                                   Fill="{DynamicResource WhiteBrush}"
                                   IsHitTestVisible="false"
                                   Opacity="0" />
                        <Border x:Name="MouseOverBorder"
                                Background="LightGray"
                                BorderThickness="0"
                                Opacity="0" />
                        <Border x:Name="CheckedBorder"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="0"
                                Background="DodgerBlue"
                                Opacity="0"/>
                        <ContentPresenter x:Name="contentPresenter"
                                          RecognizesAccessKey="True"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Margin="{TemplateBinding Padding}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

    </Style>

</ResourceDictionary>